<?php

/**
 * UniversityNews form base class.
 *
 * @method UniversityNews getObject() Returns the current form's model object
 *
 * @package    Amman to London
 * @subpackage form
 * @author     Adel Abu-Saif <adeljas@msn.com>
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseUniversityNewsForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'            => new sfWidgetFormInputHidden(),
      'university_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('University'), 'add_empty' => false)),
      'title_en'      => new sfWidgetFormInputText(),
      'text_en'       => new sfWidgetFormTextarea(),
      'image_en'      => new sfWidgetFormInputText(),
      'title_ar'      => new sfWidgetFormInputText(),
      'text_ar'       => new sfWidgetFormTextarea(),
      'image_ar'      => new sfWidgetFormInputText(),
      'expiry_date'   => new sfWidgetFormDate(),
    ));

    $this->setValidators(array(
      'id'            => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'university_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('University'))),
      'title_en'      => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'text_en'       => new sfValidatorString(array('required' => false)),
      'image_en'      => new sfValidatorPass(array('required' => false)),
      'title_ar'      => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'text_ar'       => new sfValidatorString(array('required' => false)),
      'image_ar'      => new sfValidatorPass(array('required' => false)),
      'expiry_date'   => new sfValidatorDate(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('university_news[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'UniversityNews';
  }

}
